package example.org;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.CheckBox;
import android.widget.Toast;

public class Setting extends Activity implements OnClickListener {
	CheckBox soundCheckBox;

	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.setting);

		soundCheckBox = (CheckBox) findViewById(R.id.soundCheckBox);
		soundCheckBox.setChecked(Resource.isSoundActive);
		soundCheckBox.setOnClickListener(this);
	}

	@Override
	public void onClick(View v) {
		if (v == soundCheckBox) {
			Resource.isSoundActive = soundCheckBox.isChecked();
			if (Resource.isSoundActive == true) {
				Toast.makeText(this, "SOUND ON", Toast.LENGTH_SHORT).show();
			} else {
				Toast.makeText(this, "SOUND OFF", Toast.LENGTH_SHORT).show();
			}
			Resource.WriteSetting();
		}
	}
}